約 4,504,876 件
https://w.atwiki.jp/hmiku/pages/15511.html
【登録タグ L-tone T luna note 曲 鏡音リン】 作詞:note(L-tone) 作曲:luna(L-tone) 編曲:note(L-tone) 唄:鏡音リンAppend 曲紹介 L-tone19作目。 歌詞 耳鳴りをかき消す 鉄の匂いが 雨夜になって消え散る 古い記憶を握り潰してく 媚を売った交錯中で一人 考えて絡まった様に魅せてた 続いてく 羅針盤に任せて後に普通を 飲み込んだ感情は僕を壊して 眩みだすのは 空想 愛想 狂想 終わらずに 考察に往なされ濁る真実 唾を吐きごまかしては泳ぐ目 気を保てば 少しだけ外れた君の理想は あまりにも白い目を突き付けるから動き出したんだ 目に映る世界の中 干からびた頬を裂いて 祈り、願い、手の中 信じていた未来図が 継ぎ接ぎもう破れて 何が嘘か失った 世界の真ん中だと 言われ思い手の平に 傷と傷で描いた それが語るリアルを 何時までたってなんだって色が無くたって 握り潰されても世界は回る 耳鳴りをかき消す鉄の匂いが 力なき雑音(ノイズ)を0に戻して 切り返した 染まってく公害の中の賛美歌 気休めになれば良いなんて言うから 動き出したんだ また誰かが言った助けてだって 見えない様に隠してさ それを受け止めた毎日が 飲まれて消えても繰り返す 空を仰いだ 手は冷たくて 悟ったように夜が泣き出した 流されていく汚れた赤(レッド) 分かっていたのは僕が間違った事 コメント 名前 コメント
https://w.atwiki.jp/sampleisbest/pages/203.html
開発環境 Microsoft Visual C# 2010 Express (SP1) 実行環境 Microsoft Windows XP Home Edition (SP3) プロジェクトの種類 Windows Game (4.0) プロジェクト名 HlslTexture [ソリューションのディレクトリを作成]にチェックを付けないと.slnファイルが指定した場所の直下に作られる。 MyTexture.pngはペイントなどで作る。 1つは2x2の白黒模様。 もう1つは256x256くらいで白地に黒線を1ピクセル空けて何本か引くと拡大/縮小フィルタの効果が分かりやすい。 参考 Memeplexes かんたんXNA4.0 HLSL編 その7 テクスチャ Game1.cs using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace HlslTexture { class Game1 Game { GraphicsDeviceManager graphics; Effect effect; VertexPositionTexture[] vertices = { new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0)), new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0)), new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1)), new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1)), }; float camDist = 4.0f; int camLat = 10; int camLong = 45; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; IsMouseVisible = true; } protected override void LoadContent() { // ContentにMyEffect.fxを追加しておく effect = Content.Load Effect ("MyEffect"); Matrix projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45), GraphicsDevice.Viewport.AspectRatio, 0.1f, 10); // ContentにMyTexture.pngを追加しておく Texture2D texture = Content.Load Texture2D ("MyTexture"); effect.Parameters["Projection"].SetValue(projection); effect.Parameters["MyTexture"].SetValue(texture); base.LoadContent(); } protected override void Update(GameTime gameTime) { KeyboardState state = Keyboard.GetState(); if (state[Keys.Escape] == KeyState.Down) Exit(); if (state[Keys.Up] == KeyState.Down) camLat++; if (state[Keys.Down] == KeyState.Down) camLat--; if (state[Keys.Left] == KeyState.Down) camLong++; if (state[Keys.Right] == KeyState.Down) camLong--; if (state[Keys.PageUp] == KeyState.Down) camDist -= 0.1f; if (state[Keys.PageDown] == KeyState.Down) camDist += 0.1f; base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); float rad = MathHelper.ToRadians(camLat); float y = (float)Math.Sin(rad) * camDist; float r = (float)Math.Cos(rad) * camDist; rad = MathHelper.ToRadians(camLong); float x = (float)Math.Cos(rad) * r; float z = (float)Math.Sin(rad) * r; Matrix view = Matrix.CreateLookAt(new Vector3(x, y, z), Vector3.Zero, Vector3.Up); effect.Parameters["View"].SetValue(view); foreach (var pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawUserPrimitives VertexPositionTexture ( PrimitiveType.TriangleStrip, vertices, 0, 2); } base.Draw(gameTime); } } } MyEffect.fx // Effect File float4x4 View; float4x4 Projection; texture MyTexture; sampler mySampler = sampler_state { Texture = MyTexture ; MagFilter = Point; //MagFilter = Linear; MinFilter = Point; //MinFilter = Linear; }; struct VertexPositionTexture { float4 Position POSITION; float4 TextureCoordinate TEXCOORD; }; VertexPositionTexture MyVertexShader(VertexPositionTexture input) { VertexPositionTexture output; output.Position = mul(input.Position, mul(View, Projection)); output.TextureCoordinate = input.TextureCoordinate; return output; } float4 MyPixelShader(float2 textureCoordinate TEXCOORD) COLOR { return tex2D(mySampler, textureCoordinate); } technique MyTechnique { pass MyPass { VertexShader = compile vs_2_0 MyVertexShader(); PixelShader = compile ps_2_0 MyPixelShader(); } }
https://w.atwiki.jp/eg-memo/pages/232.html
[部分編集] Cibernetico Volcano / masterkirbyxd Asteroide Coaster / DarkyBenji Fire Volcano / marioanddragon Blue Volcano / Happylei19 Ice Cap / DarkyBenji Mauna Key Valley / Fraz Lemon Volcano / SimonCT Icer Volcano / masterkirbyxd
https://w.atwiki.jp/eg-memo/pages/225.html
[部分編集] Dark Circuit (Mario Circuit Ver) / MrMario Coagulation Halo 2 / mkwiiNinclan Metal Mario Circuit / Midowned1 Rollercoasting.png / DarkyBenji Dream Realm / ALPHAMARIOX
https://w.atwiki.jp/eg-memo/pages/253.html
[部分編集] Donkey Kong Galaxy / Zero aka SneaksterMK Snow Doll Planet / HackSizer DK s Snowy Jungle / HackSizer and RobyRe Deserts River / Buschkling Morning Jungle / MrMario Green Jungles / DarkyBenji PC s / masterkirbyxd Deep Woods / MrMario Waluigi s Radiation Parkway / AdivoxAir Green Hill Zone / DarkyBenji
https://w.atwiki.jp/eg-memo/pages/230.html
[部分編集] DK s City / Buschkling Casino Park / DarkyBenji Tropical Resort / DarkyBenji
https://w.atwiki.jp/ntgrock/pages/117.html
using System; using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.GamerServices; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Media; using Microsoft.Xna.Framework.Net; using Microsoft.Xna.Framework.Storage; namespace DrawTexture2D { /// summary /// ゲームの根幹となる部分 /// /summary /// XNAで用意されたGameクラスを継承してGameMainクラスを作成 public class GameMain Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; //描画に関するデバイスの構成、管理を行うクラス SpriteBatch spriteBatch;//同じ設定でスプライトのグループを描画できるようにするクラス Texture2D texture; //画像を描画するテクスチャ /// summary /// コンストラクタ、newする時に呼ばれる。 /// /summary /// 最低限の初期化処理を行う。 public GameMain() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; //ウィンドウの横、縦幅。デフォルトで800x600 graphics.PreferredBackBufferWidth = 1200; graphics.PreferredBackBufferHeight = 800; } /// summary /// 初期化処理 /// /summary protected override void Initialize() { base.Window.Title = "RDD 製作委員会"; //ウィンドウのキャプションを設定 // TODO Add your initialization logic here base.Initialize(); } /// summary /// グラフィックスコンテントの読み込み /// /summary protected override void LoadContent() { // テクスチャを描画するためのスプライトを作成 spriteBatch = new SpriteBatch(GraphicsDevice); //テクスチャの読み込み。パスはフルパスで指定してます。 texture = Texture2D.FromFile(graphics.GraphicsDevice, "f \\neko.jpg"); // TODO use this.Content to load your game content here } /// summary /// グラフィックスコンテントの解放 /// /summary protected override void UnloadContent() { // TODO Unload any non ContentManager content here } /// summary /// 更新処理 /// /summary /// param name="gameTime" Provides a snapshot of timing values. /param protected override void Update(GameTime gameTime) { // 終了 if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || //後ろボタンを押したら Keyboard.GetState().IsKeyDown(Keys.Escape) //Escapeキーを押したら ) this.Exit(); // TODO Add your update logic here //ベースの更新、継承元クラスのUpdate()を呼び出す base.Update(gameTime); } /// summary /// 描画処理 /// /summary /// param name="gameTime" Provides a snapshot of timing values. /param protected override void Draw(GameTime gameTime) { //背景色で塗りつぶし GraphicsDevice.Clear(Color.CornflowerBlue); //スプライトの描画 spriteBatch.Begin(); spriteBatch.Draw(texture, new Vector2(0.0f, 0.0f), Color.White); spriteBatch.Draw(texture, new Vector2(0.0f, 200.0f), Color.Green); spriteBatch.Draw(texture, new Vector2(0.0f, 400.0f), new Color(0x80, 0xFF, 0x80)); spriteBatch.End(); // TODO Add your drawing code here //継承元クラスのDraw()を呼び出す。 base.Draw(gameTime); } } }
https://w.atwiki.jp/sampleisbest/pages/235.html
開発環境 Microsoft Visual C# 2010 Express (SP1) 実行環境 Microsoft Windows XP Home Edition (SP3) プロジェクトの種類 Windows Game (4.0) プロジェクト名 XnaTexture2D スクロール モルワイデ風 参考 Planet Earth Texture Maps Game1.cs // XnaTexture2D2 テクスチャ移動 using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace XnaTexture2D { class Game1 Game { GraphicsDeviceManager graphics; SpriteBatch sprite; SpriteFont font; VertexBuffer vertexBuffer; Effect effect; Texture2D texture; EffectParameter fxLat; EffectParameter fxLon; float lat = 0; float lon = 0; // fps int sec; int draw = 0; int fps = 0; public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; Content.RootDirectory = "Content"; IsMouseVisible = true; } protected override void LoadContent() { sprite = new SpriteBatch(GraphicsDevice); font = Content.Load SpriteFont ("SpriteFont1"); texture = Content.Load Texture2D ("earthmap1k"); effect = Content.Load Effect ("Effect1"); effect.Parameters["WorldMap"].SetValue(texture); fxLat = effect.Parameters["lat"]; fxLon = effect.Parameters["lon"]; VertexPositionTexture[] vertices = new VertexPositionTexture[4]; vertices[0] = new VertexPositionTexture(new Vector3(-1, 1, 0), new Vector2(0, 0)); vertices[1] = new VertexPositionTexture(new Vector3(1, 1, 0), new Vector2(1, 0)); vertices[2] = new VertexPositionTexture(new Vector3(-1, -1, 0), new Vector2(0, 1)); vertices[3] = new VertexPositionTexture(new Vector3(1, -1, 0), new Vector2(1, 1)); vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionTexture), 4, BufferUsage.WriteOnly); vertexBuffer.SetData(vertices); base.LoadContent(); } protected override void Update(GameTime gameTime) { float deltaLat = 0; float deltaLon = 0; KeyboardState kState = Keyboard.GetState(); if (kState.IsKeyDown(Keys.Escape)) Exit(); if (kState.IsKeyDown(Keys.Up)) deltaLat = -0.005f; if (kState.IsKeyDown(Keys.Down)) deltaLat = 0.005f; if (kState.IsKeyDown(Keys.Left)) deltaLon = -0.005f; if (kState.IsKeyDown(Keys.Right)) deltaLon = 0.005f; if (deltaLat != 0) { lat += deltaLat; if (lat -1.0f) lat += 2.0f; if (1.0f lat) lat -= 2.0f; fxLat.SetValue(lat); } if (deltaLon != 0) { lon += deltaLon; fxLon.SetValue(lon); } base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp; GraphicsDevice.SetVertexBuffer(vertexBuffer); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2); } // fps draw++; if (gameTime.TotalGameTime.Seconds != sec) { fps = draw; draw = 0; sec = gameTime.TotalGameTime.Seconds; } sprite.Begin(); string text = string.Format("fps={0} lat={1 f2} lon={2 f2}", fps, lat, lon); sprite.DrawString(font, text, new Vector2(0, 0), Color.Red); sprite.End(); base.Draw(gameTime); } } } Effect1.fx // スクロール texture WorldMap; float lat; float lon; sampler TextureSampler = sampler_state { texture = WorldMap ; minfilter = linear; magfilter = linear; }; struct VertexShaderInput { float4 Position POSITION0; float2 TexCoord TEXCOORD0; }; struct VertexShaderOutput { float4 Position POSITION0; float2 TexCoord TEXCOORD0; }; VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; output.Position = input.Position; output.TexCoord = input.TexCoord; return output; } float4 PixelShaderFunction(VertexShaderOutput input) COLOR0 { float2 t; t.x = frac(input.TexCoord.x + lon); //t.y = frac(input.TexCoord.y + lat); t.y = abs(input.TexCoord.y + lat); if (1.0f t.y) { t.y = 2.0f - t.y; } return tex2D(TextureSampler, t); } technique Technique1 { pass Pass1 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } } Effect1.fx // モルワイデ風 texture WorldMap; float lat; // 未使用 float lon; sampler TextureSampler = sampler_state { texture = WorldMap ; minfilter = linear; magfilter = linear; }; struct VertexShaderInput { float4 Position POSITION0; float2 TexCoord TEXCOORD0; }; struct VertexShaderOutput { float4 Position POSITION0; float2 TexCoord TEXCOORD0; }; VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; output.Position = input.Position; output.TexCoord = input.TexCoord; return output; } float4 PixelShaderFunction(VertexShaderOutput input) COLOR0 { float x = input.TexCoord.x * 2.0f - 1.0f; // -1 - 1 float y = input.TexCoord.y * 2.0f - 1.0f; // -1 - 1 float width = sqrt(1.0f - y * y); if (width abs(x) || width == 0.0f) { discard; } float2 t; t.x = frac((x / width) * 0.5f + 0.5f + lon); t.y = input.TexCoord.y; return tex2D(TextureSampler, t); } technique Technique1 { pass Pass1 { VertexShader = compile vs_2_0 VertexShaderFunction(); PixelShader = compile ps_2_0 PixelShaderFunction(); } }
https://w.atwiki.jp/sampleisbest/pages/213.html
開発環境 Microsoft Visual C# 2010 Express (SP1) 実行環境 Microsoft Windows XP Home Edition (SP3) プロジェクトの種類 Windows Game (4.0) プロジェクト名 XnaTexture Game1.cs /* * 移動は経路を最大20ステップくらいで計算し、経過時間で現在位置を割り出す。 */ using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace XnaTexture { class Game1 Game { GraphicsDeviceManager graphics; SpriteBatch sprite; SpriteFont font; // fps DateTime prevTime; int draw = 0; int fps = 0; readonly short[] rectVert = { 0, 1, 2, 1, 3, 2 }; const int fieldX = 40; const int fieldZ = 40; const int fieldXZ = fieldX * fieldZ; BasicEffect effect; Texture2D fieldTex; Texture2D texture; VertexBuffer fieldVertex; IndexBuffer fieldIndex; VertexPositionTexture[] cursorVertices; int objNum = 10; Vector3[] objPos; // カメラ Vector3 targetPos = new Vector3(fieldX / 2 + 0.5f, 0, fieldZ / 2 + 0.5f); float camDist = 15; int camLat = 45; int camLong = 180; MouseState mStateOld = new MouseState(); int mouseX; int mouseY; int momentWheel = 0; // テクスチャ系(u,v) n=0{0,0} n=1{1,0} n=2{0,1} n=3{1,1} int TU(int n) { return n 1; } int TV(int n) { return (n 1) 1; } public Game1() { graphics = new GraphicsDeviceManager(this); graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; Content.RootDirectory = "Content"; IsMouseVisible = true; } protected override void Initialize() { sprite = new SpriteBatch(GraphicsDevice); prevTime = DateTime.Now; base.Initialize(); } protected override void LoadContent() { // ソリューション エクスプローラーの(Content)に追加しておく font = Content.Load SpriteFont ("SpriteFont1"); // 新しい項目:Sprite Font //fieldTex = Content.Load Texture2D ("jt_campf_002"); fieldTex = Content.Load Texture2D ("Palette16"); texture = Content.Load Texture2D ("Palette16"); effect = new BasicEffect(GraphicsDevice); effect.TextureEnabled = true; effect.Texture = fieldTex; effect.FogEnabled = true; effect.FogColor = Color.White.ToVector3(); effect.FogStart = 25; effect.FogEnd = 35; effect.Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45), GraphicsDevice.Viewport.AspectRatio, 1, 40); GenerateFieldBuffers(); // カーソル cursorVertices = new VertexPositionTexture[4]; for (int n = 0; n 4; n++) { cursorVertices[n].TextureCoordinate = new Vector2((2 + TU(n)) / 4.0f, (1 + TV(n)) / 4.0f); } // 物体 objPos = new Vector3[objNum]; Random rnd = new Random(); for (int n = 0; n objNum; n++) { objPos[n] = new Vector3(rnd.Next(fieldX) + 0.5f, 0, rnd.Next(fieldZ) + 0.5f); } base.LoadContent(); } void GenerateFieldBuffers() { // 頂点バッファ int vertexNum = 4 * fieldXZ; VertexPositionTexture[] vertices = new VertexPositionTexture[vertexNum]; int i = 0; for (int x = 0; x fieldX; x++) { for (int z = 0; z fieldZ; z++) { for (int n = 0; n 4; n++) { vertices[i].Position = new Vector3(x + 1 - TV(n), 0, z + TU(n)); vertices[i].TextureCoordinate = new Vector2((1 + TU(n)) / 4.0f, TV(n) / 4.0f); i++; } } } fieldVertex = new VertexBuffer(GraphicsDevice, typeof(VertexPositionTexture), vertexNum, BufferUsage.WriteOnly); fieldVertex.SetData(vertices); // 索引バッファ int indexNum = 6 * fieldXZ; short[] indices = new short[indexNum]; for (int n = 0; n indexNum; n++) { indices[n] = (short)((n / 6) * 4 + rectVert[n % 6]); } fieldIndex = new IndexBuffer(GraphicsDevice, typeof(short), indexNum, BufferUsage.WriteOnly); fieldIndex.SetData(indices); } protected override void Update(GameTime gameTime) { // キーボード KeyboardState state = Keyboard.GetState(); if (state[Keys.Escape] == KeyState.Down) Exit(); if (state[Keys.W] == KeyState.Down) Move(180); if (state[Keys.S] == KeyState.Down) Move(0); if (state[Keys.A] == KeyState.Down) Move(90); if (state[Keys.D] == KeyState.Down) Move(-90); if (state[Keys.Up] == KeyState.Down) camLat = Math.Min(camLat + 1, 85); if (state[Keys.Down] == KeyState.Down) camLat = Math.Max(camLat - 1, 5); if (state[Keys.Left] == KeyState.Down) camLong = (camLong + 1) % 360; if (state[Keys.Right] == KeyState.Down) camLong = (camLong + 359) % 360; if (state[Keys.PageUp] == KeyState.Down) camDist = Math.Max(camDist - 0.1f, 10); if (state[Keys.PageDown] == KeyState.Down) camDist = Math.Min(camDist + 0.1f, 20); // マウス MouseState mState = Mouse.GetState(); if (mStateOld.ScrollWheelValue != mState.ScrollWheelValue) { momentWheel = (mStateOld.ScrollWheelValue mState.ScrollWheelValue) ? -10 10; } if (mState.RightButton == ButtonState.Pressed) { if (mStateOld.RightButton == ButtonState.Released) { mouseX = mState.X; mouseY = mState.Y; } else { camLong += (mouseX - mState.X) / 2 % 360; if (camLong 0) camLong += 360; if (360 = camLong) camLong -= 360; camLat += (mouseY - mState.Y) / 2; if (camLat 5) camLat = 5; if (85 camLat) camLat = 85; Mouse.SetPosition(mouseX, mouseY); } } mStateOld = mState; // モーメント if (momentWheel 0) { camDist = Math.Max(camDist + momentWheel * 0.02f, 10); momentWheel++; } if (0 momentWheel) { camDist = Math.Min(camDist + momentWheel * 0.02f, 20); momentWheel--; } base.Update(gameTime); } void Move(int dir) { float rad = MathHelper.ToRadians(camLong + dir); float x = (float)Math.Cos(rad) * 0.1f; float z = (float)Math.Sin(rad) * 0.1f; targetPos.X += x; targetPos.Z += z; } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.DepthStencilState = DepthStencilState.Default; // カメラ位置 float rad = MathHelper.ToRadians(camLat); float y = (float)Math.Sin(rad) * camDist; float r = (float)Math.Cos(rad) * camDist; rad = MathHelper.ToRadians(camLong); float x = (float)Math.Cos(rad) * r; float z = (float)Math.Sin(rad) * r; Vector3 cameraPos = targetPos + new Vector3(x, y, z); effect.View = Matrix.CreateLookAt(cameraPos, targetPos, Vector3.Up); // マウス MouseState mState = Mouse.GetState(); Vector3 nearPos = GraphicsDevice.Viewport.Unproject(new Vector3(mState.X, mState.Y, 0), effect.Projection, effect.View, Matrix.Identity); Vector3 farPos = GraphicsDevice.Viewport.Unproject(new Vector3(mState.X, mState.Y, 1), effect.Projection, effect.View, Matrix.Identity); Ray ray = new Ray(cameraPos, Vector3.Normalize(farPos - nearPos)); // この線と地平面との交点の座標を求める Plane plane = new Plane(Vector3.Up, 0); float? dist = ray.Intersects(plane); // Nullable Vector3 cursorPos = new Vector3(); // 3D描画 GraphicsDevice.SetVertexBuffer(fieldVertex); GraphicsDevice.Indices = fieldIndex; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); GraphicsDevice.DrawIndexedPrimitives( PrimitiveType.TriangleList, 0, 0, 4 * fieldXZ, 0, 2 * fieldXZ); if (dist.HasValue) { cursorPos = ray.Position + ray.Direction * (float)dist; int cx = (int)cursorPos.X; int cz = (int)cursorPos.Z; for (int n = 0; n 4; n++) { cursorVertices[n].Position = new Vector3(cx + 1 - TV(n), 0.1f, cz + TU(n)); } GraphicsDevice.DrawUserIndexedPrimitives VertexPositionTexture ( PrimitiveType.TriangleList, cursorVertices, 0, 4, rectVert, 0, 2); } } // フレームレート draw++; DateTime now = DateTime.Now; TimeSpan t = now - prevTime; if (t.TotalMilliseconds = 1000) { fps = draw; draw = 0; prevTime = now; } // 2D描画 sprite.Begin(SpriteSortMode.BackToFront, null); // ターゲット int num = gameTime.TotalGameTime.Milliseconds / 250; DrawObj(targetPos, num, 2, cameraPos); // 物体 foreach (Vector3 pos in objPos) { DrawObj(pos, 3, 0, cameraPos); } string text = string.Format( "fps={0} lat={1} long={2} dist={3 f1}", fps, camLat, camLong, camDist); sprite.DrawString(font, text, new Vector2(0, 0), Color.Lime); text = string.Format("x={0 f1} y={1 f1} z={2 f1}", targetPos.X, targetPos.Y, targetPos.Z); sprite.DrawString(font, text, new Vector2(0, 20), Color.Lime); text = string.Format("x={0} y={1} wheel={2} dist={3 f2}", mState.X, mState.Y, mState.ScrollWheelValue, dist); sprite.DrawString(font, text, new Vector2(0, 40), Color.Lime); text = string.Format("x={0 f1} y={1 f1} z={2 f1}", cursorPos.X, cursorPos.Y, cursorPos.Z); sprite.DrawString(font, text, new Vector2(0, 60), Color.Lime); sprite.End(); base.Draw(gameTime); } // 関数内でループさせる予定 void DrawObj(Vector3 objPos, int u, int v, Vector3 cameraPos) { Vector3 pos = GraphicsDevice.Viewport.Project( objPos, effect.Projection, effect.View, Matrix.Identity); float dist = Vector3.Distance(cameraPos, objPos); float scale = 28 / dist; Vector2 scaleV2 = new Vector2(scale, scale * (180 - camLat) / 180); Rectangle rect = new Rectangle(u * 32, v * 32, 32, 64); sprite.Draw(texture, new Vector2(pos.X, pos.Y), rect, Color.White, 0, new Vector2(16, 64), scaleV2, SpriteEffects.None, pos.Z); } } }
https://w.atwiki.jp/eg-memo/pages/206.html
[部分編集] Biodom / ALPHAMARIOX Bowsers Cave / Buschkling Ice Gorge / MrMario Destruction Gully / masterkirbyxd Planet Wisp / Darky Benji Raleg Race / mkwiiNinclan Humongous Fungus / DarkyBenji Sky Sanctuary / DarkyBenji Mushroom Hill / DarkyBenji Untitle / JEmkwii